<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:t="http://myfaces.apache.org/tomahawk">
        
    <body>
        <ui:composition template="/./ressources/template/template_member.xhtml">
        
            <ui:define name="title">
                GM. Member - Projets
            </ui:define>
            
            <ui:define name="body">
                <h1>Tableau Projets</h1>
                <p>

                    <h:form id="list" >
                        <h:dataTable value="#{currentuser.listProjetFinance}" var="item" border="0" cellpadding="1" cellspacing="0">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Id"/>
                                </f:facet>
                                <h:selectBooleanCheckbox id="valid" value="#{item.valid}" title="Valid" disabled="true"/> 
                                <h:selectBooleanCheckbox id="active" value="#{item.active}" title="Actif" disabled="true"/> 
                                <h:outputText value="#{item.id}"/>
                            </h:column>
                            
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Type"/>
                                </f:facet>
                                <h:outputText value="#{item.type.label}"/>
                            </h:column>

            
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Titre"/>
                                </f:facet>
                                <h:outputText value="#{item.title}"/>
                            </h:column>


                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Auteur"/>
                                </f:facet>
                                <h:outputText value="#{item.auteur}"/>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Date"/>
                                    
                                </f:facet>
                                <h:outputText value="#{item.dateDePublication}">
                                    <f:convertDateTime pattern="dd/MM/yyyy"/>
                                </h:outputText>
                            </h:column>

                            
                            <h:column>
                                <h:commandLink action="#{currentuser.removeProjet}">
                                    <f:param name="id" value="#{item.id}"/>
                                    <h:outputText value="Supprimer"/>
                                </h:commandLink>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{currentuser.editProjet}">
                                    <f:param name="id" value="#{item.id}"/>
                                    <h:outputText value="Editer"/>
                                </h:commandLink>
                            </h:column>
                            
                        </h:dataTable>
                        <br/>
                        <br/>
                        <h:commandLink action="#{currentuser.newBlankProjet}">
                            <h:outputText value="Nouveau"/>
                        </h:commandLink>
                        <br/>
                    </h:form> 
                    
                </p>
                

                <h2>Formulaire ressource</h2>
                <p>
                    <h:form enctype="multipart/form-data" >
                        <h:messages style="color: green" layout="table"/>
                        <h:inputHidden id="id" value="#{currentuser.managed.id}" />
                        
                        <h:panelGrid rowClasses="cntForm" columns="2">
                            
                            <h:outputText value="Titre :"/>
                            <h:panelGroup>
                                <h:inputText id="title" value="#{currentuser.managed.tiltle}" title="Title" size="30" required="true"/> 
                                <h:message for="title" styleClass="cntError" />
                            </h:panelGroup>
                            
                            <h:outputText value="Details :"/>
                            <h:panelGroup>
                                <h:inputTextarea id="details" value="#{currentuser.managed.details}" title="Details" rows="10" cols="30" /> 
                                <h:message for="details" styleClass="cntError" />
                            </h:panelGroup>

                            <h:outputText value="Auteur :"/>
                            <h:panelGroup>
                                <h:inputText id="author" value="#{currentuser.managed.auteur}" title="Author" size="30" /> 
                                <h:message for="author" styleClass="cntError" />
                            </h:panelGroup>

                            <h:outputText value="Duree de location par defaut :"/>
                            <h:panelGroup>
                                <h:inputText id="defaultDurePret" value="#{currentuser.managed.defaultDurePret}" size="7" title="defaultDurePret" required="true" /> 
                                <h:message for="defaultDurePret" styleClass="cntError" />
                            </h:panelGroup>
                            
                            <h:outputText value="Type :"/>
                            <h:panelGroup>
                                <h:selectOneListbox id="typeFk" value="#{currentuser.managed.typeFk}" title="Type" required="true" converter="typeConverter" >
                                    <f:selectItems  id="selecttype" value="#{search.listType}"  />  
                                </h:selectOneListbox>
                                <h:message for="type" styleClass="cntError" />
                            </h:panelGroup>

                            <h:outputText value="Categories :"/>
                            <h:panelGroup>
                                <h:selectManyListbox id="categories" value="#{currentuser.preteurs}" title="preteurs" >
                                    <f:selectItems  id="selectPreteurs" value="#{search.results}" />  
                                </h:selectManyListbox>
                            </h:panelGroup>

                            <h:outputText value="Actif : "/>
                            <h:panelGroup>
                                <h:selectBooleanCheckbox id="active" value="#{currentuser.managed.active}" title="Active"/> 
                            </h:panelGroup>

                            <h:outputText value="Valide : "/>
                            <h:panelGroup>
                                <h:selectBooleanCheckbox id="valid" value="#{currentuser.managed.valid}" title="Valid"/> 
                            </h:panelGroup>
                            
                            <h:outputText value="Photo : "/>
                            <h:panelGroup>
                                <t:inputFileUpload id="logo"
                                    value="#{currentuser.picture}"
                                    storage="file" accept="image/*">
                                </t:inputFileUpload>
                            </h:panelGroup>
                            
                        </h:panelGrid>
                            
                        <h:panelGrid columns="1" >
                            
                            <h:panelGroup>
                                <h:graphicImage value="loadResourceImage?resId=#{currentuser.managed.id}" />
                                <br/>
                                <h:selectBooleanCheckbox id="removePicture" value="#{currentuser.removePicture}" title="Supprime image"/> <h:outputText value="Supprimer l'image"/>
                            </h:panelGroup>

                            <h:commandButton action="#{currentuser.saveProjet}" value="Valider"/>
                                
                        </h:panelGrid>
                        
                    </h:form>

                </p>

            </ui:define>
            
        </ui:composition> 
    </body> 
</html>